import requests
from PIL import Image
from io import BytesIO


def downloadImage():
	url = "http://kevinnan.org.cn/usr/uploads/2020/08/4185436490.png"
	r  = requests.get(url)
	print(r.headers)
	print(r.encoding)
	print(r.status_code)
	image = Image.open(BytesIO(r.content))
	image.show()

def main():
	# url = "https://www.baidu.com"
	url = "https://www.douban.com/"
	headers = {'User-Agent': 
			   'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.221 Safari/537.36 SE 2.X MetaSr 1.0'}
	r = requests.get(url, headers=headers)
	print(r.status_code)
	print(r.encoding)

	r_n = requests.get(url, headers=None)
	print(r_n.status_code)
	print(r_n.encoding)
	

if __name__ == '__main__':
	main()